﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Crosland.Automotriz.Web.Repuestos
{
    public partial class wFrmPronosticoImportacionAprobacionDetalle : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {



                Cargar_Detalle((string)Session["nro_pedido"]);




            }
        
        
        
        }










        public void Cargar_Detalle(string nu_pedido)
        {

            try
            {
                ObjectDataSource1.SelectParameters.Clear();
                ObjectDataSource1.SelectParameters.Add("nu_pedido", nu_pedido);
                ObjectDataSource1.SelectMethod = "listarDet";
                ObjectDataSource1.Select();
                ObjectDataSource1.DataBind();
            }
            catch 
            { }

          
        }

        protected void dgDetallePedido_CustomUnboundColumnData(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewColumnDataEventArgs e)
        {
            if (e.Column.FieldName == "Total")
            {
                decimal price = (decimal)e.GetListSourceFieldValue("cant_sug_real");
                decimal quantity = (decimal)e.GetListSourceFieldValue("fob_me");
                e.Value = price * quantity;
            }
        }
   
     

        protected void dgDetallePedido_PageIndexChanged(object sender, EventArgs e)
        {
            Cargar_Detalle((string)Session["nro_pedido"]);
        }


    }
}